package cst.a816wzj.zyfypt_816wzj.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

import cst.a816wzj.zyfypt_816wzj.AmicoolListener;
import cst.a816wzj.zyfypt_816wzj.ArticleAdapter;
import cst.a816wzj.zyfypt_816wzj.R;
import cst.a816wzj.zyfypt_816wzj.ResModel;
import cst.a816wzj.zyfypt_816wzj.TwareBean;

/**
 * Created by Administrator on 2017/5/22.
 */

public class TwareFragment extends Fragment {
    private RecyclerView recyclerView;
    private ArticleAdapter adapter;
    private List<TwareBean> list;
    private RecyclerView.LayoutManager layoutManager;
    private AmicoolListener<List<TwareBean>> listener;
    private ResModel model;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view=inflater.inflate(R.layout.fragment_article,container,false);
        recyclerView = (RecyclerView)view.findViewById(R.id.article_rec);
        adapter = new ArticleAdapter(getActivity());
        list = new ArrayList<TwareBean>();
        layoutManager = new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setAdapter(adapter);
        listener = new AmicoolListener<List<TwareBean>>() {
            @Override
            public void onResponse(List<TwareBean> k) {
               // adapter.setList();
            }

            @Override
            public void onFail(String msg) {

            }
        };
        model = new ResModel("gson");
        model.getList("article",1,listener);
        return view;
    }
}
